/**
 * JavaScript Document
 * compressby KuoqiPHP
 * version kq.1.10
 * CreateDate 2022-12-11 10:53:23
 */
 
 
!function(KuoqiJs) {
    if ("object" == typeof exports && "undefined" != typeof module)
        module.exports = KuoqiJs();
    else if ("function" == typeof define && define.amd)
        define([], KuoqiJs);
    else {
        var t;
        t = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this,
        t.$Q = t.kuoqiJs = KuoqiJs();
    }
}(function() {
    var KuoqiJs;
    return function KuoqiJs(c) {
        function a() {}
        ;if (c && c.type == 'KuoqiJsObject') {
            KuoqiJs.__proto__ = c;
            KuoqiJs.plugIn = {
                register: function(plugname, plugbody) {
                    KuoqiJs.library.plugIn.push(plugname);
                    this[plugname] = plugbody;
                },
                time: function(opts) {
                    return;
                    opts.timestame = parseInt(opts.timestame);
                    setInterval(function() {
                        var date = new $Q.date({
                            timeStamp: opts.timestame
                        });
                        k._e_e.selector(opts.boxElement).html(date.output());
                        opts.timestame++;
                    }, 1000);
                },
            },
            a = KuoqiJs;
        } else {
            a = KuoqiJs.selector(c);
        }
        ;return a;
    }({
        selector: function(a, b, c) {
            if (a && a.Type == 'Knodelist') {
                return a;
            }
            ;var node = new function Knodelist() {
                var self = this;
                this.Type = 'Knodelist';
                this.Function = null;
                this.Selector = a;
                this.PseudoSelector = '';
                this.PseudoSelectorIndex = 0;
                this.Limit = b ? b : null;
                this.JustChild = c ? c : 0;
                this.length = 0;
                this.sType = null;
                this.Element = [];
                this.Readylist = [];
                this._callback = null;
                this.ready = function(func) {
                    if (Object.prototype.toString.call(func) == '[object Function]') {
                        self.Function.library.readlist.push(func);
                    } else {
                        if (this.sType == '[object HTMLDocument]') {
                            self.Function.library.readlist.forEach(function(e) {
                                self._callback = e;
                                e();
                            })
                        }
                    }
                }
                ;
                this.addClass = function(className) {
                    this.each(function(i, e) {
                        if (!self.Function.selector(this).hasClass(className)) {
                            if (this.classList == 0) {
                                this.className = className;
                            } else {
                                (this.className += ' ' + className)
                            }
                        }
                    });
                    return this;
                }
                ;
                this.after = function(s, debug) {
                    return this.parent().next(s);
                }
                ;
                this.ajaxConts = function(opts) {
                    var ths = this;
                    opts = self.Function.opts(opts, {
                        action: '',
                        data: {},
                        method: 'get',
                        header: {},
                    }, 'action');
                    var p = self.Function.proxy(opts);
                    p.success = function(a, b, c) {
                        ths.html(a);
                        opts.success && opts.success();
                    }
                    ;
                    p.error = function() {
                        ths.html('<span>404</span>');
                        opts.error && opts.error();
                    }
                    ;
                    p.send();
                }
                ;
                this.ajaxSubmit = function(opts) {
                    try {
                        if (this.isValid()) {
                            var data = this.getFormdata(this);
                            var action = this.getAttr('action');
                            var method = this.getAttr('method');
                            opts = self.Function.opts(opts, {
                                action: action ? action : "",
                                method: method ? method : 'get',
                                data: {},
                            });
                            var proxy = self.Function.proxy(opts);
                            proxy.setDatas(data);
                            proxy.setDatas(opts.data);
                            proxy.send();
                        } else {
                            self.Function.msg('Invalid form submission');
                        }
                        ;
                    } catch (err) {
                        console.log(err);
                    }
                    ;
                }
                ;
                this.animation = function(opts) {
                    var self = this;
                    opts = self.Function.opts(opts, {
                        'focusElement': this,
                        'rotateZangle': 0,
                        'rotateZspeed': 1,
                        'rotateXangle': 0,
                        'rotateXspeed': 0,
                        'rotateYangle': 0,
                        'rotateYspeed': 0,
                        'timer': 10,
                    }, 'animationType');
                    return new function Kanimation() {
                        this.opts = opts;
                        opts.ths = this;
                        this.doCircle = function() {
                            opts.focusElement.attr('data-animation-rotateZangle', opts.rotateZangle);
                            var doThis = function() {
                                var angle = opts.focusElement.attr('data-animation-rotateZangle');
                                angle = parseFloat(angle);
                                angle += parseFloat(opts.rotateZspeed ? opts.rotateZspeed : 1);
                                opts.focusElement.css('transform', 'rotate(' + angle + 'deg)');
                                opts.focusElement.attr('data-animation-rotateZangle', angle);
                                setTimeout(function() {
                                    doThis();
                                }, opts.timer);
                            };
                            doThis();
                        }
                        ;
                        this.doRoute = function(code) {
                            opts.focusElement.attr('data-animation-rotateZangle', opts.rotateZangle);
                            var doThis = function() {
                                var angle = opts.focusElement.attr('data-animation-rotateZangle');
                                angle = parseFloat(angle);
                                angle += parseFloat(opts.rotateZspeed ? opts.rotateZspeed : 1);
                                opts.focusElement.css('transform', 'rotate' + code + '(' + angle + 'deg)');
                                opts.focusElement.attr('data-animation-rotateZangle', angle);
                                setTimeout(function() {
                                    doThis();
                                }, opts.timer);
                            };
                            doThis();
                        }
                        ;
                        this.doAnimation = function() {
                            switch (opts.animationType) {
                            case 'circle':
                                this.doCircle();
                                break;
                            case 'routeX':
                                this.doRoute('X');
                                break;
                            case 'routeY':
                                this.doRoute('Y');
                                break;
                            case 'routeZ':
                                this.doRoute('Z');
                                break;
                            }
                        }
                        ;
                        this.sync = function() {
                            this.doAnimation();
                        }
                        ;
                        this.sync();
                    }
                }
                ;
                this.append = function(s) {
                    if (s && (s.Type == 'Knodelist')) {
                        this.each(function() {
                            var ths = this;
                            self.Function.selector(s).each(function() {
                                ths.appendChild(this);
                            })
                        });
                        return this;
                    } else if (Object.prototype.toString.call(s).indexOf('[object HTML') == 0) {
                        this.each(function() {
                            this.appendChild(s);
                        });
                        return this;
                    } else if (Object.prototype.toString.call(s).indexOf('[object NodeList') == 0) {
                        self.Function.selector(this).each(function() {
                            var ths = this;
                            self.Function.selector(s).each(function() {
                                ths.appendChild(this);
                            })
                        });
                        return self.Function.selector(this);
                    } else {
                        var h = self.Function.parseHTML(s, true);
                        self.Function.selector(this).each(function() {
                            var ths = this;
                            self.Function.selector(h).each(function() {
                                ths.appendChild(this);
                            })
                        });
                        return self.Function.selector(this);
                    }
                    ;
                }
                ;
                this.attr = function(attrName, attrValue) {
                    if (!attrName)
                        ;return null;
                    return (attrValue == undefined) ? this.getAttr(attrName) : this.setAttr(attrName, attrValue);
                }
                ;
                this.before = function(s) {
                    return this.parent().prev(s);
                }
                ;
                this.change = function(a) {
                    (a == undefined) ? ((function(e) {
                        e.each(function() {
                            this.onchange && this.onchange();
                        })
                    }
                    )(this)) : ((function(e) {
                        e.each(function(ei) {
                            ei.onchange = a;
                        })
                    }
                    )(this));
                }
                ;
                this.children = function(selector, neq) {
                    var nodeord = self.Function.selector(selector, this);
                    var node = self.Function.selector();
                    this.Element.forEach(function(e) {
                        for (var i = 0; i < e.children.length; i++) {
                            if (neq) {
                                if (e.children[i] == neq) {
                                    continue;
                                }
                            }
                            ;if (nodeord.length) {
                                nodeord.each(function(ee) {
                                    if (e.children[i] == ee) {
                                        node.push(e.children[i]);
                                    }
                                });
                            } else if (selector) {} else {
                                node.push(e.children[i]);
                            }
                        }
                    });
                    return node;
                }
                ;
                this.click = function(a) {
                    var ret = true;
                    (a == undefined) ? ((function(ele) {
                        ele.each(function(e) {
                            ret *= e.click(a);
                        })
                    }
                    )(this)) : ((function(ele) {
                        ele.each(function(e) {
                            (a === false) ? ((function(e1) {
                                e.onclick = function(ev) {
                                    if (ev == null) {
                                        return false;
                                    }
                                    ;if (ev.stopPropagation) {
                                        ev.stopPropagation();
                                    } else if (window.ev) {
                                        window.ev.cancelBubble = true;
                                    }
                                }
                            }
                            )(e)) : e.addEventListener("click", function(evt) {
                                this.a = a;
                                this.a(evt);
                            });
                        })
                    }
                    )(this));
                }
                ;
                this.clone = function() {
                    var str = '';
                    this.each(function() {
                        str += this.outerHTML;
                    });
                    return this.Function.selector(str);
                }
                ;
                this.css = function(a, b) {
                    return (typeof (a) == 'object') ? ((function(ths) {
                        ths.each(function() {
                            for (var i in a) {
                                this.style.setProperty(i, (typeof (a[i]) == 'function') ? ((a[i])(this)) : a[i]);
                            }
                        });
                        return ths;
                    }
                    )(this)) : (b == undefined) ? ((function(e) {
                        return e.style.getPropertyValue(a);
                    }
                    )(this.first(true))) : ((function(ths) {
                        ths.each(function() {
                            this.style.setProperty(a, (typeof (b) == 'function') ? ((b)(this)) : b);
                        })
                    }
                    )(this));
                }
                ;
                this.data = function(n, v) {
                    if (v == undefined) {
                        return this.getData(n);
                    } else {
                        return this.setData(n, v);
                    }
                }
                ;
                this.doOn = function(en) {
                    this.each(function(i, e) {
                        this['on' + en] && this['on' + en]()
                    })
                }
                ;
                this.each = function(_cbk) {
                    for (var i = 0; i < this.Element.length; i++) {
                        this.Element[i]._cbk = _cbk;
                        this.Element[i]._cbk(this.Element[i], i);
                    }
                    ;return true;
                }
                ;
                this.empty = function() {
                    this.each(function(i, e) {
                        this.innerHTML = '';
                    });
                    return this;
                }
                ;
                this.eq = function(index) {
                    return this.Function.selector(this.Element[parseInt(index) - 1]);
                }
                ;
                this.files = function(index) {
                    var files = [];
                    this.each(function(e) {
                        if (e.files) {
                            for (var i = 0; i < e.files.length; i++) {
                                files.push(e.files[i]);
                            }
                        }
                        ;
                    });
                    if (index != undefined) {
                        return files[index] ? files[index] : null;
                    }
                    ;return files;
                }
                ;
                this.find = function(selector) {
                    return self.Function.selector(selector, this, true);
                }
                ;
                this.first = function(isEle) {
                    var e = this.Element[0] ? this.Element[0] : null;
                    return isEle ? e : this.Function.selector(e);
                }
                ;
                this.firstChild = function(isEle) {
                    var e = this.Element[0] ? this.Element[0].firstElementChild : null;
                    return isEle ? e : this.Function.selector(e);
                }
                ;
                this.focus = function(fc) {
                    return fc ? ((function(ths) {
                        return (typeof (fc) == 'function') ? ((function() {
                            ths.addEventListener("focus", fc, true);
                            return self.Function.selector(ths);
                        }
                        )()) : self.Function.selector(ths);
                    }
                    )(this.first(true))) : ((function(ths) {
                        ths.focus();
                        return self.Function.selector(ths);
                    }
                    )(this.first(true)))
                }
                ;
                this.fullScreen = function(callback) {
                    var docElm = this.first(true);
                    if (!docElm) {
                        this.Function.error("请使用元素来全屏");
                        return;
                    }
                    ;if (docElm.requestFullscreen) {
                        docElm.requestFullscreen();
                    } else if (docElm.msRequestFullscreen) {
                        docElm.msRequestFullscreen();
                    } else if (docElm.mozRequestFullScreen) {
                        docElm.mozRequestFullScreen();
                    } else if (docElm.webkitRequestFullScreen) {
                        docElm.webkitRequestFullScreen();
                    }
                    document.onfullscreenchange = function() {
                        callback && callback();
                    }
                }
                ;
                this.getAttr = function(attributeName) {
                    var e = this.first(true);
                    return e ? e.getAttribute(attributeName) : null;
                }
                ;
                this.getData = function(dataName) {
                    var e = this.first(true);
                    return e ? e.getAttribute("data-" + dataName) : null;
                }
                ;
                this.getFormdata = function() {
                    var formdata = {};
                    try {
                        var setData = function(nm, vl) {
                            var type = Object.prototype.toString.call(formdata[nm]);
                            if (type == '[object Array]') {
                                formdata[nm].push(vl);
                            } else {
                                formdata[nm] = vl;
                            }
                        };

                        var getType = function(ele) {
                            var tp = self.Function.selector(ele).getAttr('type');
                            tp = self.Function.strtolower(tp);
                            if (!tp) {
                                tp = '';
                            }
                            ;return tp;
                        };
                        this.find("[name]").each(function(ele) {
                            var tp = getType(ele);
                            var nm = self.Function.selector(ele).attr('name');
                            var hnm = /^([0-9a-zA-Z\_\[\]]+)(\[\])$/g.exec(nm);
                            if (hnm) {
                                nm = hnm[1];
                                if (!formdata[nm])
                                    formdata[nm] = [];
                            }
                            switch (tp) {
                            case 'checkbox':
                                if (self.Function.selector(ele).prop('checked')) {
                                    var vl = self.Function.selector(ele).val();
                                    setData(nm, vl);
                                }
                                break;
                            case 'radio':
                                if (self.Function.selector(ele).prop('checked')) {
                                    var vl = self.Function.selector(ele).val();
                                    setData(nm, vl);
                                }
                                break;
                            case 'file':
                                var multiple = self.Function.selector(ele).getAttr('multiple');
                                if (multiple == 'multiple') {
                                    var vl = self.Function.selector(ele).files();
                                } else {
                                    var vl = self.Function.selector(ele).files(0);
                                }
                                setData(nm, vl);
                                break;
                            default:
                                var vl = self.Function.selector(ele).val();
                                setData(nm, vl);
                            }
                        });
                    } catch (err) {
                        console.log(err);
                    }
                    ;return formdata;
                }
                ;
                this.getProp = function(a) {
                    return this.first(true)[a];
                }
                ;
                this.hasAttr = function(abn) {
                    var e = this.first(true);
                    return e ? e.hasAttribute(abn) : null;
                }
                ;
                this.hasClass = function(className) {
                    var a = false;
                    var e = this.first(true);
                    if (!e) {
                        return false;
                    }
                    for (var i = 0; i < e.classList.length; i++) {
                        if (e.classList[i] == className) {
                            a = true;
                        }
                    }
                    ;return a;
                }
                ;
                this.hasData = function(dataName) {
                    var e = this.first(true);
                    return e ? e.hasAttribute("data-" + dataName) : null;
                }
                ;
                this.hasProp = function(a) {
                    return this.first(true)[a] ? true : false;
                }
                ;
                this.height = function(p) {
                    if (this.length == 0) {
                        return 0;
                    }
                    ;return (p == undefined) ? ((function(e) {
                        return e.offsetHeight
                    }
                    )(this.first(true))) : ((function(ths) {
                        ths.each(function() {
                            this.style.height = parseFloat(p) + "px";
                        });
                    }
                    )(this));
                }
                ;
                this.hide = function() {
                    return this.css('display', 'none')
                }
                ;
                this.html = function(opts) {
                    if (this.length == 0) {
                        return null;
                    }
                    ;return (opts == undefined) ? ((function(e) {
                        return e ? e.innerHTML : '';
                    }
                    )(this.first(true))) : ((function(ths) {
                        ths.empty();
                        ths.each(function() {
                            if (opts.Type && opts.Type == 'Knodelist') {
                                var sths = self.Function.selector(this);
                                opts.each(function() {
                                    sths ? sths.append(this) : null;
                                })
                            } else {
                                this ? this.innerHTML = opts : null;
                            }
                        })
                    }
                    )(this))
                }
                ;
                this.index = function() {
                    var ele = this.first(true);
                    if (ele === null) {
                        return -1;
                    }
                    ;var par = this.parent(true);
                    for (var i = 0; i < par.children.length; i++) {
                        if (ele == par.children[i]) {
                            return i;
                        }
                    }
                    ;return -1;
                }
                ;
                this.isValid = function() {
                    return this.isValied();
                }
                ;
                this.isValied = function() {
                    var ths = this;
                    var form = this.first(true);
                    if (form.tagName != 'FORM') {
                        return;
                    }
                    ;var getType = function(ele) {
                        var tp = self.Function.selector(ele).getData('type');
                        tp = self.Function.strtolower(tp);
                        if (!tp) {
                            tp = '';
                        }
                        ;return tp;
                    };
                    var isValied = true;
                    this.find("[name]").each(function(ele) {
                        var val = self.Function.selector(this).val();
                        switch (getType(ele)) {
                        case 'require':
                            if (val.length < 1) {
                                self.Function.selector(ele).focus();
                                ths.setProp('focusElement', ele);
                                isValied = false;
                            }
                            break;
                        default:
                            ;
                        }
                    });
                    return isValied;
                }
                ;
                this.last = function(isEle) {
                    var e = this.Element[this.Element.length - 1] ? this.Element[this.Element.length - 1] : null;
                    return isEle ? e : this.Function.selector(e);
                }
                ;
                this.lastChild = function(isEle) {
                    var e = this.Element[this.Element.length - 1] ? this.Element[this.Element.length - 1].lastElementChild : null;
                    return isEle ? e : this.Function.selector(e);
                }
                ;
                this.moveToNext = function() {
                    var next = this.next().next();
                    if (next.first(true)) {
                        this.parent().first(true).insertBefore(this.first(true), next.first(true));
                    } else {
                        this.parent().append(this.first(true));
                    }
                }
                ;
                this.moveToPrev = function() {
                    var prev = this.prev();
                    if (prev.first(true)) {
                        this.parent().first(true).insertBefore(this.first(true), prev.first(true));
                    } else {
                        this.parent().prepend(this.first(true));
                    }
                }
                ;
                this.next = function(s) {
                    if (s == undefined) {
                        var e = this.first(true);
                        return self.Function.selector(e ? e.nextElementSibling : null);
                    } else {
                        if (s && s.Type && s.Type == 'Knodelist') {
                            var h = s.first(true);
                        } else if (Object.prototype.toString.call(s).indexOf('[object HTML') == 0) {
                            var h = s;
                        } else {
                            var h = this.Function.parseHTML(s);
                            h = h[0];
                        }
                        ;return this.Function.selector(this.parent().first(true).insertBefore(h, this.next().first(true)));
                    }
                }
                ;
                this.on = function(code, evt) {
                    this.each(function(i, e) {
                        (evt == undefined) ? (self.Function.selector(this).doOn(code)) : ((function(ths) {
                            var c = 'on' + code;
                            ths[c] = evt;
                        }
                        )(this));
                    })
                }
                ;
                this.parent = function(isEle) {
                    if (this.first(true).parentElement) {
                        return isEle ? this.first(true).parentElement : this.Function.selector(this.first(true).parentElement);
                    } else {
                        return this.Function.selector();
                    }
                }
                ;
                this.parents = function(selector) {
                    var l = self.Function.selector(selector);
                    if (l.length == 0) {
                        return null;
                    }
                    ;var p = this.parent();
                    if (p.length == 0) {
                        return null;
                    }
                    ;var n = self.Function.selector();
                    l.each(function(e) {
                        if (e == p.first(true)) {
                            n.push(e);
                        }
                    });
                    if (n.length == 0) {
                        return p.parents(selector);
                    }
                    ;return n;
                }
                ;
                this.prepend = function(s) {
                    if (s == undefined) {
                        return self.Function.selector(this.prev());
                    } else {
                        this.each(function() {
                            if (s && s.Type && s.Type == 'Knodelist') {
                                var h = s.first(true);
                            } else if (Object.prototype.toString.call(s).indexOf('[object HTML') == 0) {
                                var h = s;
                            } else {
                                var h = self.Function.parseHTML(s);
                                h = h[0];
                            }
                            ;if (this.childNodes.length) {
                                this.insertBefore(h, this.firstChild);
                            } else {
                                this.appendChild(h);
                            }
                        });
                    }
                    ;return this;
                }
                ;
                this.prev = function(s) {
                    if (s == undefined) {
                        var e = this.first(true);
                        return this.Function.selector(e ? e.previousElementSibling : null);
                    } else {
                        this.each(function() {
                            if (s && s.Type && s.Type == 'Knodelist') {
                                var h = s.first(true);
                            } else if (Object.prototype.toString.call(s).indexOf('[object HTML') == 0) {
                                var h = s;
                            } else {
                                var h = self.Function.parseHTML(s);
                                h = h[0];
                            }
                            ;this.parentNode.insertBefore(h, this);
                        });
                    }
                    ;return this;
                }
                ;
                this.prop = function(ppn, ppv) {
                    if (!ppn)
                        ;return null;
                    return (ppv === undefined) ? this.getProp(ppn) : this.setProp(ppn, ppv);
                }
                ;
                this.push = function(node) {
                    this.Element.push(node);
                    this.length = this.Element.length;
                }
                ;
                this.remove = function() {
                    if (this.Element.length > 0) {
                        this.each(function(e) {
                            var p;
                            (p = e.parentNode) && (p.removeChild(e));
                        })
                    }
                }
                ;
                this.removeAttr = function(attrName) {
                    this.each(function(e) {
                        e.removeAttribute(attrName);
                    });
                    return this;
                }
                ;
                this.removeClass = function(className) {
                    this.each(function(e) {
                        var c = '';
                        if (e.classList && e.classList.length > 0) {
                            for (var j = 0; j < e.classList.length; j++) {
                                var a = e.classList[j];
                                if (a != className) {
                                    if (c) {
                                        c += ' ' + a;
                                    } else {
                                        c += a;
                                    }
                                }
                            }
                            e.className = c;
                        }
                    });
                    return this;
                }
                ;
                this.removeData = function(dataName) {
                    this.each(function(e) {
                        e.removeAttribute("data-" + dataName);
                    });
                    return this;
                }
                ;
                this.removeProp = function(propName) {
                    this.each(function(e) {
                        delete (e[propName])
                    });
                    return this;
                }
                ;
                this.scrollToBottom = function() {
                    this.each(function(e) {
                        e.scrollTop = e.scrollHeight;
                    })
                }
                ;
                this.selectorByString = function() {
                    var list = this.Function.parseHTML(this.Selector);
                    list.forEach(function(e) {
                        self.push(e);
                    });
                }
                ;
                this.selectorByNodelist = function() {
                    for (var i = 0; i < this.Selector.length; i++) {

                        this.push(this.Selector[i]);
                    }
                }
                ;
                this.setectorByNode = function() {
                    this.push(this.Selector);
                }
                ;
                this.selectorBySelector = function() {
                    this.Selector.replace(/(\S+)\:(\S+)/, function(rs, rs1, rs2) {
                        self.Selector = rs1;
                        self.PseudoSelector = self.Function.strtoupper(rs2);
                        rs2.replace(/^(\w+)\((\d+)\)$/, function(rs21, rs22, rs23) {
                            self.PseudoSelector = self.Function.strtoupper(rs22);
                            self.PseudoSelectorIndex = rs23;
                        });
                        return;
                    });
                    if (this.Limit) {
                        var lis = [];
                        this.Limit.each(function(e) {
                            var list = e.querySelectorAll(self.Selector);
                            list.forEach(function(ee) {
                                lis.push(ee);
                            });
                        });
                    } else {
                        var lis = document.querySelectorAll(this.Selector);
                    }
                    ;if (self.PseudoSelector == 'FIRST') {
                        if (lis.length) {
                            self.push(lis[0]);
                        }
                    } else if (self.PseudoSelector == 'LAST') {
                        if (lis.length) {
                            self.push(lis[lis.length - 1]);
                        }
                    } else if (self.PseudoSelector == 'FIRSTCHILD') {
                        console.log('FIRSTCHILD');
                    } else if (self.PseudoSelector == 'LASTCHILD') {
                        console.log('LASTCHILD');
                    } else if (self.PseudoSelector == 'EQ') {
                        lis.forEach(function(e, i) {
                            if (i + 1 == self.PseudoSelectorIndex) {
                                self.push(e);
                            }
                        });
                    } else if (self.PseudoSelector == 'NEQ') {
                        lis.forEach(function(e, i) {
                            if (i + 1 != self.PseudoSelectorIndex) {
                                self.push(e);
                            }
                        });
                    } else {
                        lis.forEach(function(e, i) {
                            self.push(e);
                        });
                    }
                }
                ;
                this.selectorByDocument = function() {
                    this.element = document;
                    document.onreadystatechange = function(e) {
                        if (this.readyState == 'complete') {
                            self.ready();
                        }
                    }
                }
                ;
                this.selectorByOther = function() {
                    if (/^\[object\sHTML/.test(this.sType)) {
                        this.setectorByNode();
                    }
                    ;if (/^\[object\sSVG/.test(this.sType)) {
                        this.setectorByNode();
                    }
                }
                ;
                this.setAttr = function(attrName, attrVal) {
                    this.each(function(e) {
                        e.setAttribute(attrName, attrVal);
                    });
                    return this;
                }
                ;
                this.setData = function(dataName, dataValue) {
                    this.each(function(e) {
                        e.setAttribute("data-" + dataName, dataValue);
                    });
                    return this;
                }
                ;
                this.setProp = function(a, b) {
                    this.each(function(e) {
                        e[a] = b;
                    });
                    return this;
                }
                ;
                this.show = function() {
                    this.css('display', 'block');
                }
                ;
                this.siblings = function(selecter) {
                    return this.parent().children(selecter, this.first(true));
                }
                ;
                this.submit = function(func) {
                    return (typeof (func) == 'function') ? ((function(ths) {
                        ths.each(function() {
                            this.onsubmit = function() {
                                this._cbk = func;
                                this._cbk();
                                return false;
                            }
                        });
                    }
                    )(this)) : ((function(ths) {
                        ths.each(function() {
                            this.submit();
                        })
                    }
                    )(this));
                }
                ;
                this.text = function(text) {
                    if (text == undefined) {
                        return this.first(true) ? this.first(true).textContent : null;
                    } else {
                        this.each(function(e, i) {
                            e.textContent = text;
                        })
                    }
                    ;return this;
                }
                ;
                this.touch = function() {
                    var ths = this;
                    var touch = new function Ktoucher() {
                        this.touchStart = null;
                        this.touchMove = null;
                        this.touchEnd = null;
                        this.onMovePoint = 64;
                        this.onLongPoint = 1000;
                        this.isTouchMove = false;
                        this.isTouchLong = false;
                        this.tmpTouchLongtimer = 0;
                        this.onMoveToLeft = null;
                        this.onMoveToRight = null;
                        this.onTouchFocus = null;
                        this.onTouchBlur = null;
                        this.onTouchLong = null;
                        this.doMoveLength = function() {
                            var sx = this.touchStart.touches[0].screenX;
                            var sy = this.touchStart.touches[0].screenY;
                            var ex = this.touchEnd.changedTouches[0].screenX;
                            var ey = this.touchEnd.changedTouches[0].screenY;
                            if (sx - ex > this.onMovePoint) {
                                this.onMoveToLeft && this.onMoveToLeft(this);
                            }
                            ;if (ex - sx > this.onMovePoint) {
                                this.onMoveToRight && this.onMoveToRight(this);
                            }
                        }
                        ;
                        this.doLongPress = function() {
                            if (!this.isTouchMove) {
                                this.onTouchLong && this.onTouchLong();
                            }
                        }
                        ;
                        var that = this;
                        self.selector(ths).on('touchStart', function(rs) {
                            that.touchStart = rs;
                            that.touchMove = null;
                            that.touchEnd = null;
                            that.isTouchMove = false;
                            that.isTouchLong = false;
                            that.tmpTouchLongtimer = setTimeout(function() {
                                that.doLongPress();
                            }, that.onLongPoint);
                        });
                        self.selector(ths).on('touchMove', function(rs) {
                            that.touchMove = rs;
                            that.isTouchMove = true;
                        });
                        self.selector(ths).on('touchEnd', function(rs) {
                            that.touchEnd = rs;
                            if (that.tmpTouchLongtimer) {
                                clearTimeout(that.tmpTouchLongtimer);
                            }
                            that.doMoveLength();
                        });
                    }
                    ;
                    return touch;
                }
                ;
                this.val = function(v) {
                    return (v == undefined) ? ((function(ths) {
                        return ths.value;
                    }
                    )(this.first(true))) : ((function(ths) {
                        ths.each(function() {
                            this.value = v;
                            this.oninput && this.oninput();
                        });
                        return ths;
                    }
                    )(this))
                }
                ;
                this.width = function(p) {
                    return (p == undefined) ? ((function(e) {
                        return e.offsetWidth
                    }
                    )(this.first(true))) : ((function(e) {
                        e.each(function() {
                            this.style.width = parseFloat(p) + "px";
                        })
                    }
                    )(this));
                }
                ;
                this.analysisSelector = function() {
                    this.sType = Object.prototype.toString.call(a);
                    if (this.sType == '[object String]') {
                        if (!/\</.test(this.Selector)) {
                            this.sType = '[object Selector]';
                        }
                    }
                    switch (this.sType) {
                    case '[object Selector]':
                        this.selectorBySelector();
                        break;
                    case '[object String]':
                        this.selectorByString();
                        break;
                    case '[object HTMLDocument]':
                        this.selectorByDocument();
                        break;
                    case '[object NodeList]':
                        this.selectorByNodelist();
                        break;
                    case '[object HTMLCollection]':
                        this.selectorByNodelist();
                        break;
                    default:
                        this.selectorByOther();
                    }
                    ;this.length = this.Element.length;
                }
                ;
            }
            ;
            node.Function = this;
            node.analysisSelector();
            return node;
        },
        ajax: function(opts) {
            var self = this;
            return new function kajax() {
                this.opts = self.opts(opts, {
                    url: '',
                    type: 'get',
                    data: {},
                    dataType: '',
                    success: function() {},
                    error: function() {},
                    isSec: false,
                    secCheck: function(rs, yes_back, err_back) {},
                });
                this.opts.method = this.opts.type;
                this.opts.action = this.opts.url;
                this.proxy = self.proxy(this.opts);
                this.proxy.send();
            }
        },
        alert: function(opts) {
            var self = this;
            return new function kuoqialert() {
                var ths = this;
                this.opts = self.opts(opts, {
                    tips: '',
                    width: ((function() {
                        if (self.isMobile()) {
                            return '80%';
                        } else {
                            return '400px';
                        }
                    }
                    )()),
                    text: '',
                    class: 'card card-api card-alert',
                    sureText: '关闭',
                    sureStyle: 'margin: 5px;vertical-align: bottom;box-sizing: border-box;background-color: unset;border: 1px solid #dedede;border-radius: 5px;padding: 5px 10px;opacity: 0.95;cursor: pointer;',
                    cancel: function() {
                        return true;
                    },
                }, 'text');
                this.opts.content = '<div style="margin:15px;">' + (this.opts.text ? this.opts.text : "") + '</div>';
                this.card = self.card(this.opts);
                this.card.card.surebtn = self.selector('<button type="button" style="' + this.opts.sureStyle + '">' + this.opts.sureText + '</button>');
                this.card.card.surebtn.on('click', function() {
                    ths.card.card.titleCloseBtn.click();
                });
                this.card.card.body.html(this.opts.content);
                this.card.card.foot.css("text-align", "center");
                this.card.card.foot.html(this.card.card.surebtn);
            }
        },
        base64encode: function(stream) {
            return window.btoa(stream);
        },
        base64decode: function(stream) {
            return window.atob(stream);
        },
        card: function(opts) {
            var self = this;
            var card = function kuoqicard(opts) {
                this.opts = opts;
                this.library = {
                    format: {},
                    content: '',
                    position: 'c',
                    title: '',
                    formatOptions: {
                        head: {
                            format: 'head',
                            classname: 'card-head',
                            css: {
                                "display": "flex",
                                "align-items": "center",
                                "background-color": "#ddd",
                                "padding": "0.25em 0.5em",
                            },
                            isshow: true,
                        },
                        body: {
                            format: 'body',
                            classname: 'card-body',
                            css: {
                                "padding": "0.25em 0.5em",
                            },
                            isshow: true,
                        },
                        foot: {
                            format: 'foot',
                            classname: 'card-foot',
                            css: {
                                "padding": "0.25em 0.5em",
                            },
                            isshow: true,
                        },
                        card: {
                            format: 'card',
                            classname: '',
                            css: {
                                "border": "1px solid #dedede",
                                "background-color": "#fff",
                                "position": "absolute",
                                "opacity": "0"
                            },
                            isshow: true,
                        },
                    },
                    dragOffsetpoint: [0, 0],
                    dragIsrun: 0,
                };
                this.width = 0;
                this.height = 0;
                this.fwidth = 0;
                this.fheight = 0;
                this.x = 0;
                this.y = 0;
                this.isFull = 0;
                this.card = {};
                this.onCancel = null;
                this.onLoaded = null;
                this.doCancel = function(e) {
                    this.doDestroy();
                    this.onCancel && this.onCancel();
                }
                ;
                this.doLoaded = function(e) {
                    this.onLoaded && this.onLoaded();
                }
                ;
                this.doDestroy = function() {
                    this.card.backdrop.remove();
                }
                ;
                this.syncEvent = function() {
                    var ths = this;
                    this.card.titleCloseBtn.on('click', function(e) {
                        ths.doCancel(e);
                    });
                    this.card.title.on('dragstart', function(e) {
                        ths.library.dragOffsetpoint = [e.offsetX, e.offsetY, ];
                        ths.card.card.css("box-shadow", "0px 0px 6px 2px");
                        ths.card.card.css("opacity", "0.6");
                    });
                    this.card.title.on('drag', function(e) {
                        if (e.clientX <= 0) {
                            return
                        }
                        ;if (!ths.library.dragIsrun) {
                            ths.library.dragIsrun = 1;
                            return;
                        }
                        ths.card.card.css("left", (e.pageX - ths.library.dragOffsetpoint[0]) + "px");
                        ths.card.card.css("top", (e.pageY - ths.library.dragOffsetpoint[1]) + "px");
                    });
                    this.card.title.on('dragend', function(e) {
                        ths.card.card.css("box-shadow", "unset");
                        ths.card.card.css("opacity", "1");
                        ths.library.dragIsrun = 0;
                    });
                }
                ;
                this.create = function() {
                    this.card['card'].addClass(this.opts.classname);
                    this.syncEvent();
                    this.doLoaded();
                    this.card.card.css("opacity", 1);
                }
                ;
                this.createContent = function(callback) {
                    this.card['body'].html(this.library.content, function(e) {
                        callback && callback();
                    });
                }
                ;
                this.createPosition = function() {
                    this.width = Math.ceil(this.card.card.width());
                    this.height = Math.ceil(this.card.card.height());
                    this.fwidth = Math.ceil(this.card.backdrop.width());
                    this.fheight = Math.ceil(this.card.backdrop.height());
                    positionC = function(ths) {
                        ths.x = (ths.fwidth - ths.width) / 2;
                        ths.y = (ths.fheight - ths.height) / 2;
                    }
                    ;
                    positionT = function(ths) {
                        ths.x = (ths.fwidth - ths.width) / 2;
                        ths.y = 0;
                    }
                    ;
                    positionR = function(ths) {
                        ths.x = (ths.fwidth - ths.width);
                        ths.y = (ths.fheight - ths.height) / 2;
                    }
                    ;
                    positionB = function(ths) {
                        ths.x = (ths.fwidth - ths.width) / 2;
                        ths.y = (ths.fheight - ths.height);
                    }
                    ;
                    positionL = function(ths) {
                        ths.x = 0;
                        ths.y = (ths.fheight - ths.height) / 2;
                    }
                    ;
                    positionTR = function(ths) {
                        ths.x = (ths.fwidth - ths.width);
                        ths.y = 0;
                    }
                    ;
                    positionBR = function(ths) {
                        ths.x = (ths.fwidth - ths.width);
                        ths.y = (ths.fheight - ths.height);
                    }
                    ;
                    positionBL = function(ths) {
                        ths.x = 0;
                        ths.y = (ths.fheight - ths.height);
                    }
                    ;
                    positionTL = function(ths) {
                        ths.x = 0;
                        ths.y = 0;
                    }
                    ;
                    switch (this.library.position) {
                    case 'C':
                        positionC(this);
                        break;
                    case 'T':
                        positionT(this);
                        break;
                    case 'R':
                        positionR(this);
                        break;
                    case 'B':
                        positionB(this);
                        break;
                    case 'L':
                        positionL(this);
                        break;
                    case 'TR':
                        positionTR(this);
                        break;
                    case 'BR':
                        positionBR(this);
                        break;
                    case 'BL':
                        positionBL(this);
                        break;
                    case 'TL':
                        positionTL(this);
                        break;
                    default:
                        console.error('position ' + this.library.position + 'is can not do this');
                    }
                    ;this.card.card.css('left', this.x + "px");
                    this.card.card.css('top', this.y + "px");
                }
                ;
                this.createUI = function() {
                    this.card['backdrop'] = $Q('<div style="z-index:' + this.opts.zIndex + '"></div>');
                    this.card['card'] = $Q('<div></div>');
                    this.card['head'] = $Q('<div></div>');
                    this.card['body'] = $Q('<div></div>');
                    this.card['foot'] = $Q('<div></div>');
                    this.card['title'] = $Q('<div draggable="true" style="flex:auto;cursor: all-scroll;">' + (this.library.title ? this.library.title : '&nbsp;') + '</div>');
                    this.card['titleCtl'] = $Q('<div stype="padding-left: 1rem;"></div>');
                    this.card['titleCtlMaxbtn'] = $Q('<button type="button" style="border: none;background-color: unset;color: inherit;">&nbsp;</button>');
                    this.card['titleCtlMinbtn'] = $Q('<button type="button" style="border: none;background-color: unset;color: inherit;">&nbsp;</button>');
                    this.card['titleCloseBtn'] = $Q('<button type="button" style="border: none;background-color: unset;color: inherit;">×</divbutton');
                    if (this.library.format.head.isshow) {
                        this.card.card.append(this.card.head);
                        this.card.head.css(this.library.format.head.css);
                        this.card.head.addClass(this.library.format.head.classname);
                        this.card.head.css(this.library.format.head.css);
                        this.card.titleCtl.append(this.card.titleCtlMinbtn);
                        this.card.titleCtl.append(this.card.titleCtlMaxbtn);
                        this.card.titleCtl.append(this.card.titleCloseBtn);
                        this.card.head.append(this.card.title);
                        this.card.head.append(this.card.titleCtl);
                    }
                    ;if (this.library.format.body.isshow) {
                        this.card.card.append(this.card.body);
                        this.card.body.addClass(this.library.format.body.classname);
                        this.card.body.css(this.library.format.body.css);
                    }
                    ;if (this.library.format.foot.isshow) {
                        this.card.card.append(this.card.foot);
                        this.card.foot.addClass(this.library.format.foot.classname);
                        this.card.foot.css(this.library.format.foot.css);
                    }
                    ;if (this.library.formatOptions.card.isshow) {
                        this.card.card.addClass(this.library.formatOptions.card.classname);
                        this.card.card.css(this.library.formatOptions.card.css);
                        if (this.opts.width) {
                            if (typeof (this.opts.width) == 'number') {
                                this.opts.width = this.opts.width + "px";
                            }
                            ;this.card.card.css("width", this.opts.width);
                        }
                        ;if (this.opts.height) {
                            if (typeof (this.opts.height) == 'number') {
                                this.opts.height = this.opts.height + "px";
                            }
                            ;this.card.card.css("height", this.opts.height);
                        }
                    }
                    ;this.card['backdrop'].css({
                        "position": "fixed",
                        "left": "0",
                        "top": "0",
                        "right": "0",
                        "bottom": "0"
                    });
                    this.card['backdrop'].append(this.card['card']);
                    self.selector('body').append(this.card['backdrop']);
                }
                ;
                analysisOptsFormatOne = function(part, def) {
                    return self.opts(part, def, 'format');
                }
                ;
                this.analysisOptsFormat = function() {
                    var lis = ['head', 'body', 'foot'];
                    var fmt = this.opts.format;
                    for (var i = 0; i < fmt.length; i++) {
                        var tmp = new analysisOptsFormatOne(fmt[i],this.library.formatOptions[fmt[i]]);
                        this.library.format[tmp["format"]] = tmp;
                    }
                    ;if (!this.library.format.head) {
                        this.library.format.head = new analysisOptsFormatOne({
                            format: 'head',
                            isshow: false
                        },this.library.formatOptions.head);
                    }
                    ;if (!this.library.format.body) {
                        this.library.format.body = new analysisOptsFormatOne({
                            format: 'body',
                            isshow: false
                        },this.library.formatOptions.body);
                    }
                    ;if (!this.library.format.foot) {
                        this.library.format.foot = new analysisOptsFormatOne({
                            format: 'foot',
                            isshow: false
                        },this.library.formatOptions.foot);
                    }
                }
                ;
                this.analysisOptsContent = function() {
                    var content = this.opts.content;
                    this.library.content = self.selector(self.parseHTML(content));
                    this.library.position = self.strtoupper(this.opts.position);
                }
                ;
                this.syncInput = function() {
                    this.opts.classname || (this.opts.classname = this.opts.class);
                    this.analysisOptsFormat();
                    this.analysisOptsContent();
                    this.library.title = this.opts.title ? this.opts.title : this.opts.tips;
                    this.onCancel = this.opts.cancel;
                    this.onLoaded = this.opts.loaded;
                    this.library.content = this.opts.content;
                }
                ;
                this.syncInput();
                this.createUI();
                this.createContent();
                this.createPosition();
                this.create();
            };
            return new card(this.opts(opts, {
                classname: '',
                width: 0,
                height: 0,
                format: ['head', 'body', 'foot'],
                title: '',
                cancel: null,
                loaded: null,
                sure: null,
                content: '',
                position: 'c',
                backgroundClick: null,
                zIndex: 0,
                hasBgcolor: false,
                bgColor: null,
                autoCreate: true,
                callback: null,
                tips: '',
                class: 'card card-api',
            }));
        },
        config: function(cname, cvalue) {
            if (cname) {
                return ((cvalue == undefined) || (cvalue == null)) ? this.library.config[cname] : (this.library.config[cname] = cvalue);
            } else {
                return '';
            }
        },
        confirm: function(opts) {
            var self = this;
            return new function kuoqiconfirm() {
                var ths = this;
                this.opts = self.opts(opts, {
                    tips: '',
                    width: ((function() {
                        if (self.isMobile()) {
                            return '80%';
                        } else {
                            return '400px';
                        }
                    }
                    )()),
                    text: '',
                    class: 'card card-api card-confirm',
                    sureText: '确定',
                    sureStyle: 'margin: 5px;vertical-align: bottom;box-sizing: border-box;background-color: unset;border: 1px solid #dedede;border-radius: 5px;padding: 5px 10px;opacity: 0.95;cursor: pointer;',
                    cancelText: '取消',
                    cancelStyle: 'margin: 5px;vertical-align: bottom;box-sizing: border-box;background-color: unset;border: 1px solid #dedede;border-radius: 5px;padding: 5px 10px;opacity: 0.95;cursor: pointer;',
                    sure: null,
                    cancel: null,
                });
                this.onSure = null;
                this.doSure = function() {
                    this.onSure && this.onSure();
                    this.opts.sure && this.opts.sure();
                    ths.card.doDestroy();
                }
                ;
                this.opts.content = '<div style="margin:15px;">' + (this.opts.text ? this.opts.text : "") + '</div>';
                this.card = self.card(this.opts);
                this.card.card.surebtn = self.selector('<button type="button" style="' + this.opts.sureStyle + '">' + this.opts.sureText + '</button>');
                this.card.card.cancelbtn = self.selector('<button type="button" style="' + this.opts.cancelStyle + '">' + this.opts.cancelText + '</button>');
                this.card.card.surebtn.on('click', function(e) {
                    ths.doSure();
                });
                this.card.card.cancelbtn.on('click', function(e) {
                    ths.card.card.titleCloseBtn.click();
                });
                this.card.card.body.html(this.opts.content);
                this.card.card.foot.css("text-align", "center");
                this.card.card.foot.append(this.card.card.surebtn);
                this.card.card.foot.append(this.card.card.cancelbtn);
            }
        },
        createElement: function(tagName) {
            return document.createElement(tagName);
        },
        createID: function(scale, isRand) {
            return scale + (isRand ? Math.ceil(Math.random() * 100000) : '');
        },
        date: function(options) {
            return new function Kdate() {
                var opts = this.opts = self.optionsInput(options, {
                    format: 'YYYY-mm-dd HH:ii:ss',
                    timeStamp: (new Date()).getTime() / 1000,
                    stream: '',
                }, 'timeStamp');
                opts.ths = this;
                if (this.opts.timeStamp) {
                    this.opts.timeStamp = parseInt(this.opts.timeStamp);
                    this.date = new Date(this.opts.timeStamp * 1000);
                } else {
                    this.date = new Date();
                }
                ;this.getYear = function() {
                    return this.date.getFullYear();
                }
                ;
                this.getMonth = function() {
                    return this.date.getMonth() + 1;
                }
                ;
                this.getDate = function() {
                    return this.date.getDate();
                }
                ;
                this.getDay = function() {
                    return this.date.getDay();
                }
                ;
                this.getHours = function() {
                    return this.date.getHours();
                }
                ;
                this.getMinutes = function() {
                    return this.date.getMinutes();
                }
                ;
                this.getSeconds = function() {
                    return this.date.getSeconds();
                }
                ;
                this.getTime = function() {
                    return this.date.getTime();
                }
                ;
                this.getMonthDatenum = function() {
                    var date = new Date(this.getYear(),this.getMonth());
                    date.setTime(date.getTime() - 86400 * 1000);
                    return date.getDate();
                }
                ;
                this.setYear = function(Y) {
                    this.date.setFullYear(Y);
                    return this;
                }
                ;
                this.setMonth = function(m) {
                    this.date.setMonth(parseInt(m) - 1);
                    return this;
                }
                ;
                this.setDate = function(d) {
                    this.date.setDate(d);
                    return this;
                }
                ;
                this.setHours = function(H) {
                    this.date.setHours(H);
                    return this;
                }
                ;
                this.setMinutes = function(m) {
                    this.date.setMinutes(m);
                    return this;
                }
                ;
                this.setSeconds = function(s) {
                    this.date.setSeconds(s);
                    return this;
                }
                ;
                this.setTime = function(t) {
                    this.date.setTime(parseFloat(t) * 1000);
                    return this;
                }
                ;
                this.next = function(nt) {
                    this.date.setTime(this.date.getTime() + parseFloat(nt) * 1000);
                    return this;
                }
                ;
                this.prev = function(pv) {
                    this.date.setTime(this.date.getTime() - parseFloat(pv) * 1000);
                    return this;
                }
                ;
                this.format = function(format) {
                    this.opts.format = format;
                    return this;
                }
                ;
                this.output = function(format) {
                    if (format) {
                        this.opts.stream = format;
                    } else {
                        this.opts.stream = this.opts.format;
                    }
                    ;this.opts.stream = this.opts.stream.replace(/Y{1,4}/g, function(rs) {
                        return opts.ths.getYear().toString().substring(4 - rs.length, 4);
                    });
                    this.opts.stream = this.opts.stream.replace(/m{1,2}/g, function(rs) {
                        return self.strspad(opts.ths.getMonth(), '0', 2);
                    });
                    this.opts.stream = this.opts.stream.replace(/d{1,2}/g, function(rs) {
                        return self.strspad(opts.ths.getDate(), '0', 2);
                    });
                    this.opts.stream = this.opts.stream.replace(/H{1,2}/g, function(rs) {
                        return self.strspad(opts.ths.getHours(), '0', 2);
                    });
                    this.opts.stream = this.opts.stream.replace(/i{1,2}/g, function(rs) {
                        return self.strspad(opts.ths.getMinutes(), '0', 2);
                    });
                    this.opts.stream = this.opts.stream.replace(/s{1,2}/g, function(rs) {
                        return self.strspad(opts.ths.getSeconds(), '0', 2);
                    });
                    return this.opts.stream;
                }
                ;
            }
        },
        debug: function(opts) {
            var str = '<section style="position: relative;z-index: 519101;">';
            var debugObject = function(object, index) {
                str += '<details>';
                str += '<summary>[Object:' + index + ']</summary>';
                str += '<div>';
                for (var i in object) {
                    doDebug(object[i], i);
                }
                str += '</div>';
                str += '</details>';
            };
            var debugArray = function(object, index) {
                str += '<details>';
                str += '<summary>[Array:' + index + ']</summary>';
                str += '<div>';
                for (var i in object) {
                    doDebug(object[i], i);
                }
                str += '</div>';
                str += '</details>';
            };
            var doDebug = function(opts, index) {
                str += '<div style="margin-left: 15px;">';
                var type = Object.prototype.toString.call(opts, index);
                switch (type) {
                case '[object Object]':
                    debugObject(opts, index);
                    break;
                case '[object Array]':
                    debugArray(opts, index);
                    break;
                case '[object Function]':
                    str += index + ' : [Function][]';
                    break;
                case '[object String]':
                    str += index + ' : [String]"' + opts + '"';
                    break;
                case '[object Number]':
                    str += index + ' : [Number]' + opts;
                    break;
                case '[object HTMLDocument]':
                    str += index + ' : [HTMLDocument]' + opts;
                    break;
                case '[object Boolean]':
                    str += index + ' : [Boolean]' + (opts ? 'true' : 'false');
                    break;
                case '[object Null]':
                    str += index + ' : [Null]' + 'null';
                    break;
                case '[object Undefined]':
                    str += index + ' : [Undefined]' + 'Undefined';
                    break;
                default:
                    console.log(type);
                }
                str += '</div>';
                return str;
            };
            doDebug(opts, 'main');
            str += '</section>';
            this.selector('body').append(str);
        },
        error: function(msg) {
            console.warn('$Q.error:' + msg);
        },
        file: function(file) {
            var self = this;
            return new function Kfile() {
                this.onprogress = null,
                this.onsuccess = null,
                this.onerror = null,
                this.oncompress = null,
                this.secMaxsize = 524288;
                this.secSize = 0;
                this.seclist = [];
                this.secMaxnum = 0;
                this.secMaxlev = 0;
                this.uploadStatus = 0;
                this.pointer = 0;
                this.fileReader = new FileReader();
                this.tryMaxnum = 5;
                this.file = file;
                this.uploadName = 'filename';
                this.isUpload = 0;
                this.isSec = 0;
                this.onUploadProgress = null,
                this.onSecProgress = null,
                this.err = null;
                this.secCheck = function(rs) {
                    return true;
                }
                ;
                this.md5 = '';
                this.def_updata = {};
                this.tmp = {};
                this.sendIndex = 0;
                this.uploadSepeed = null;
                var ths = this;
                this.getTmpurl = function() {
                    return window.URL.createObjectURL(this.file);
                }
                ;
                this.createBynone = function(_scall, _ecall) {
                    self.error('点击尝试创建文件对象', 'file->createBynone');
                    var ths = this;
                    var ele = self.selector('<input hidden="" type="file" />');
                    self.selector('body').append(ele);
                    ele.change(function() {
                        self.error('点击尝试创建文件对象返回', 'file->createBynone');
                        ths.file = self.selector(this).files(0);
                        self.selector(ele).remove();
                        ths._callback = _scall;
                        ths._callback && ths._callback();
                    });
                    ele.click();
                }
                ;
                this.getFilename = function() {
                    return this.file.name;
                }
                ;
                this.getFilesize = function(isByte) {
                    return isByte ? this.file.size : self.filebyte2size(this.file.size);
                }
                ;
                this.getSecfileWithnoupload = function() {
                    for (var i = 0; i < this.seclist.length; i++) {
                        if (this.seclist[i].uploadStatus == 0) {
                            return this.seclist[i];
                        }
                    }
                    ;return null;
                }
                ;
                this.doCreateSecBynow = function(callback) {
                    var ths = this;
                    var data = {};
                    data.secSize = this.secSize;
                    data.pointer = this.pointer;
                    var blob = this.file.slice(ths.pointer, ths.secSize + ths.pointer, ths.file.type);
                    data['blob'] = blob;
                    this.fileReader.onloadend = function() {
                        var file = {};
                        var conts = btoa(this.result);
                        file.binary = new File([conts],ths.file.name,{
                            type: ths.file.type
                        });
                        file.md5 = self.md5(conts);
                        file.sec_id = self.strspad(ths.pointer, 0, ths.secMaxlev);
                        file.uploadStatus = 0;
                        file.tryUploadnum = ths.tryMaxnum;
                        file.tryUploadnow = 0;
                        ths.seclist.push(file);
                        data.file = file;
                        ths.oncompress && ths.oncompress(k.error(0, 'ok', data));
                        ths.pointer += ths.secSize;
                        callback && callback();
                        return;
                    }
                    ;
                    this.fileReader.readAsBinaryString(blob);
                }
                ;
                this.doCreateSec = function(callback) {
                    var ths = this;
                    if (this.pointer >= this.secMaxnum) {
                        self.error('切片完成，需要执行监听方法的话，在这里绑定', 'file');
                        callback && callback();
                    } else {
                        this.doCreateSecBynow(function() {
                            ths.doCreateSec(callback);
                        });
                    }
                }
                ;
                this.doSec = function(callback) {
                    if (!this.file) {
                        self.error('文件信息不存在，切片自动退出');
                        return callback && callback();
                    }
                    ;if (this.secSize) {
                        this.seclist = [];
                        this.pointer = 0;
                        this.secMaxnum = 0;
                        this.secMaxlev = 0;
                        this.secMaxnum = Math.ceil(this.file.size / this.secSize);
                        this.secMaxlev = Object(this.secMaxnum).toString().length;
                        this.doCreateSec(function() {
                            self.error('切片完成，等待下一步处理', 'file');
                            callback && callback();
                        });
                    } else {
                        self.error('不需要切片');
                        return callback && callback();
                    }
                }
                ;
                this.upload_sendfull = function() {
                    var ths = this;
                    self.error('upload_sendfull', 'file');
                    this.proxy.emptyDatas();
                    this.proxy.setData('upload_type', 'file');
                    this.proxy.setData(this.uploadName, this.file);
                    this.proxy.setDatas(this.def_updata);
                    this.proxy.success = function(rs) {
                        ths.isUpload = 1;
                        ths.onsuccess && ths.onsuccess(rs);
                    }
                    ;
                    this.proxy.error = function(rs) {
                        ths.isUpload = 2;
                        ths.onerror && ths.onerror(rs);
                    }
                    ;
                    this.proxy.send();
                }
                ;
                this.upload_sendsec = function(callback) {
                    var ths = this;
                    var send = function() {
                        var sec = ths.getSecfileWithnoupload();
                        if (sec) {
                            k.debug('upload_sendsec', 'sec');
                            ths.proxy.emptyDatas();
                            ths.proxy.setData('upload_type', 'sec');
                            ths.proxy.setData(ths.uploadName, sec.binary);
                            ths.proxy.setData('md5', sec.md5);
                            ths.proxy.setDatas(ths.def_updata);
                            ths.proxy.success = function(rs) {
                                sec.uploadStatus = 1;
                                send();
                            }
                            ;
                            ths.proxy.error = function(rs) {
                                if (sec.tryUploadnow >= sec.tryUploadnum) {
                                    sec.uploadStatus = 2;
                                } else {
                                    sec.uploadStatus = 0;
                                    sec.tryUploadnow++;
                                }
                                send();
                            }
                            ;
                            ths.proxy.send();
                        } else {
                            callback && callback();
                        }
                    };
                    send();
                }
                ;
                this.proxy = self.proxy({
                    dataType: 'json',
                    method: 'post',
                    data: {},
                    progress: function(cfg) {
                        ths.onprogress && ths.onprogress(cfg);
                    },
                });
                this.upload = function(url) {
                    var ths = this;
                    this.proxy.setUrl(url);
                    if (this.secSize) {
                        self.error('文件上传被执行，需要分片', 'file.upload()');
                        this.doSec(function() {
                            ths.upload_sendsec(function() {
                                self.error('上传完成', 'file');
                                ths.isUpload = 1;
                                ths.onsuccess && ths.onsuccess(ths);
                            });
                        });
                    } else {
                        self.error('文件上传被执行，不需要分片', 'file.upload()');
                        this.upload_sendfull();
                    }
                }
            }
        },
        files: function() {
            var self = this;
            return new function Kfilelist() {
                var ths = this;
                this.createBynone = function(callback) {
                    var ths = this;
                    var ele = self.selector('<input multiple="multiple" hidden="" type="file" />');
                    self.selector('body').append(ele);
                    ele.change(function() {
                        for (var i = 0; i < this.files.length; i++) {
                            ths.files.push(self.file(this.files.item(i)));
                        }
                        self.selector(ele).remove();
                        ths.callback = callback;
                        ths.callback && ths.callback();
                    });
                    ele.click();
                }
                ;
                this.files = [];
                this.push = function(file) {
                    this.files.push(self.file(file));
                }
                ;
                this.each = function(func) {
                    for (var i = 0; i < this.files.length; i++) {
                        this.tmpFile = func;
                        this.tmpFile(i, this.files[i]);
                    }
                }
                ;
                this.item = function(index) {
                    return this.files[index] ? this.files[index] : self.file();
                }
                ;
            }
        },
        filebyte2size: function(b) {
            b = parseInt(b);
            var u = '';
            if (b / 1024 > 1) {
                b = b / 1024;
                u = "k";
            }
            ;if (b / 1024 > 1) {
                b = b / 1024;
                u = "m";
            }
            ;return parseFloat(b).toFixed(2).toString() + u;
        },
        filesize2byte: function(t) {
            t = this.strtolower(t);
            var b = 1;
            t = t.replace(/[km]/, function(r1) {
                if (r1 == 'm') {
                    b = 1048576;
                } else if (r1 == 'k') {
                    b = 1024;
                }
                ;return '';
            });
            return parseFloat(t) * b;
        },
        form: function(options) {
            var self = this;
            return new function Kuoqiform() {
                var ths = this;
                this.element = null;
                this.tmp_form = null;
                this.tmp_method = 'get';
                this.tmp_action = '';
                this.tmp_enctype = 'multipart/form-data';
                this.tmp_target = 'self';
                this.formdata = new FormData();
                this.append = function(n, v) {
                    this.formdata.append(n, v);
                }
                ;
                this.setAction = function(action) {
                    this.tmp_action = action;
                }
                ;
                this.setMethod = function(method) {
                    this.tmp_method = method;
                }
                ;
                this.setEnctype = function(enctype) {
                    this.tmp_enctype = enctype;
                }
                ;
                this.setTarget = function(target) {
                    this.tmp_target = target;
                }
                ;
                this.isNew = function() {
                    this.tmp_target = 'new';
                }
                ;
                this.setHeaders = function() {}
                ;
                this.submit = function() {
                    if (this.tmp_form) {
                        self(this.tmp_form).submit();
                    } else {
                        this.install();
                        this.submit();
                    }
                }
                ;
                this.clear = function() {
                    return this.tmp_form ? this.tmp_form.remove() : '';
                }
                ;
                this.uninstall = function() {
                    this.clear();
                }
                ;
                this.install = function(isShow) {
                    this.clear();
                    isShow = isShow ? isShow : 0;
                    this.tmp_form = self('<form></form>');
                    self('body').append(this.tmp_form);
                    this.tmp_form.append('<label style="display: block;"><span>请求地址：' + this.tmp_action + '</span></label>');
                    this.tmp_form.append('<label style="display: block;"><span>请求方式：' + this.tmp_method + '</span></label>');
                    this.formdata.forEach(function(v, n) {
                        ths.tmp_form.append('<label style="display: block;"><span>' + n + '</span><input name="' + n + '" value="' + v + '" /></label>');
                    });
                    this.tmp_form.attr('action', this.tmp_action);
                    this.tmp_form.attr('method', this.tmp_method);
                    this.tmp_form.attr('enctype', this.tmp_enctype);
                    this.tmp_form.attr('target', this.tmp_target);
                    if (isShow) {
                        this.tmp_form.show();
                    } else {
                        this.tmp_form.hide();
                    }
                }
                ;
                this.print = function() {
                    return this.install(1);
                }
                ;
                this.init = function(options) {
                    if (Object.prototype.toString.call(options) == '[object HTMLFormElement]') {
                        this.element = options;
                    } else if (Object.prototype.toString.call(options) == '[object String]') {
                        this.element = self(options).first(true);
                    } else {
                        return self.error('function customized');
                    }
                    ;this.setMethod(self(this.element).attr('method'));
                    this.setAction(self(this.element).attr('action'));
                    this.setEnctype(self(this.element).attr('enctype'));
                    this.setTarget(self(this.element).attr('target'));
                }
                ;
                this.init(options);
            }
        },
        get: function(url, dataType, success, error) {
            return this.ajax({
                url: url,
                dataType: dataType,
                type: 'get',
                success: success,
                error: error
            });
        },
        getConfig: function(n) {
            return this.library.config[n] ? this.library.config[n] : '';
        },
        isFullscreen: function() {
            return !!(document.fillscreen || document.modFulIScreen || document.webkitIsFullScreen || document.webkitFullScreen || document.msFullScreen);
        },
        isIos: function() {
            var ua = navigator.userAgent;
            return !!ua.match(/(i[^;]+;( U;)? CPU.+Mac OS X)/);
        },
        isMobile: function() {
            var ua = navigator.userAgent;
            if (ua.match(/Android/i) || ua.match(/webBos/i) || ua.match(/iPhone/i) || ua.match(/iPad/i) || ua.match(/iPod/i) || ua.match(/BlackBerry/i) || ua.match(/Windows Phone/i)) {
                return true;
            }
            ;return false;
        },
        jsonDecode: function(s) {
            return this.parseJSON(s);
        },
        jsonEncode: function(o) {
            return this.stringifyJSON(o);
        },
        loading: function(isShow) {
            var self = this;
            (isShow === false) ? ((function(ths) {
                ths.loadingEnd();
            }
            )(this)) : ((function(ths) {
                self.getConfig('LOADING_IMG') ? ths.loadingStartwithimg({
                    img: self.getConfig('LOADING_IMG'),
                    rotate: self.getConfig('LOADING_IMG_PROTATE'),
                    scale: self.getConfig('LOADING_SCALE'),
                    timer: self.getConfig('LOADING_TIMER')
                }) : ths.loadingStart();
            }
            )(this))
        },
        loadingStart: function() {
            var self = this;
            return new function Kloading() {
                var ths = this;
                this.opts = self.opts({}, {
                    format: ['body'],
                    autoCreate: false,
                });
                this.card = self.card(this.opts);
                this.card.box1 = self.selector('<div style="width: 120px;height: 120px;position: relative;border-radius: 50%;border: 5px solid #4eee71;box-sizing: content-box;overflow: hidden;"></div>');
                this.card.box2 = self.selector('<div style="width: 110px;height: 110px;border-radius: 50%;border: 5px solid #a0b;;box-sizing: border-box;position: absolute;border-left-color: #fff;overflow: hidden;left: 5px;top: 5px;border-right-color: #fff;"></div>');
                this.card.box3 = self.selector('<div style="width: 90px;height: 90px;position: relative;border-radius: 50%;border: 5px solid #3F51B5;box-sizing: border-box;border-left-color: #fff;border-right-color: #fff;overflow: hidden;position: absolute;left: 15px; top: 15px;"></div>');
                this.card.box4 = self.selector('<div style="width: 80px;height: 80px;position: relative;border-radius: 50%;border: 5px solid #4eee71;padding: 5px;box-sizing: border-box;overflow: hidden;position: absolute;left: 20px;top: 20px;border-top-color: #fff;border-bottom-color: #fff;"></div>');
                this.card.box5 = self.selector('<div style="width: 60px;height: 60px;border-radius: 50%;box-sizing: content-box;position: absolute;background-color: #fff;left: 25px;top: 25px;border: 5px solid #E91E63;line-height: 60px;font-size: 12px;text-align: center;"></div>');
                this.card.box1.append(this.card.box2);
                this.card.box1.append(this.card.box3);
                this.card.box1.append(this.card.box4);
                this.card.box1.append(this.card.box5);
                this.card.box4.animation({
                    animationType: 'circle',
                    rotateZspeed: 2,
                });
                this.card.box3.animation({
                    animationType: 'circle',
                    rotateZspeed: -4,
                });
                this.card.box2.animation({
                    animationType: 'circle',
                    rotateZspeed: 6,
                });
                this.card.box5.text('loading..');
                this.card.card.body.append(this.card.box1);
                var card = this.card.card;
                this.card.card.card.css({
                    'border': 'none',
                    'box-shadow': 'none',
                    'background': 'none',
                    'left': function() {
                        var code = (window.innerWidth - card.card.width()) / 2;
                        return code + 'px';
                    },
                    'top': function() {
                        var code = (window.innerHeight - card.card.height()) / 2;
                        return code + 'px';
                    },
                });
                this.card.create();
                self.library.loading = this;
            }
        },
        loadingEnd: function() {
            this.library.loading && this.library.loading.card && this.library.loading.card.doCancel();
            this.library.loading = null;
        },
        loadingStartwithimg: function(opts) {
            return new function Kloading() {
                this.opts = k._f.optionsInput(opts, {
                    format: ['body'],
                    zIndex: '6519101',
                    class: 'card-loading',
                    autoCreate: false,
                });
                this.card = new k._f.card(this.opts);
                this.card.box1 = k._e_e.selector('<div style="width: 120px;height: 120px;position: relative;border-radius: 50%;box-sizing: content-box;overflow: hidden;"></div>');
                this.card.box2 = k._e_e.selector('<img style="width: 120px;height: 120px;" src="' + opts.img + '"/>');
                this.card.box1.append(this.card.box2);
                this.card.box2.animation({
                    animationType: opts.scale,
                    rotateZspeed: opts.rotate,
                    timer: opts.timer
                });
                this.card.format.body.append(this.card.box1);
                this.card.format.card.css({
                    'border': 'none',
                    'box-shadow': 'none',
                    'background': 'none',
                });
                this.card.create();
                k._loading = this;
            }
        },
        setProcess: function(n, v) {
            var process = this.process();
            process.set(n, v);
        },
        loadpage: function(opts) {
            return this.pageOpen(opts);
        },
        md5: function(a) {
            function b(a, b) {
                var c = (65535 & a) + (65535 & b)
                  , d = (a >> 16) + (b >> 16) + (c >> 16);
                return d << 16 | 65535 & c
            }
            function c(a, b) {
                return a << b | a >>> 32 - b
            }
            function d(a, d, e, f, g, h) {
                return b(c(b(b(d, a), b(f, h)), g), e)
            }
            function e(a, b, c, e, f, g, h) {
                return d(b & c | ~b & e, a, b, f, g, h)
            }
            function f(a, b, c, e, f, g, h) {
                return d(b & e | c & ~e, a, b, f, g, h)
            }
            function g(a, b, c, e, f, g, h) {
                return d(b ^ c ^ e, a, b, f, g, h)
            }
            function h(a, b, c, e, f, g, h) {
                return d(c ^ (b | ~e), a, b, f, g, h)
            }
            function i(a, c) {
                a[c >> 5] |= 128 << c % 32,
                a[(c + 64 >>> 9 << 4) + 14] = c;
                var d, i, j, k, l, m = 1732584193, n = -271733879, o = -1732584194, p = 271733878;
                for (d = 0; d < a.length; d += 16)
                    i = m,
                    j = n,
                    k = o,
                    l = p,
                    m = e(m, n, o, p, a[d], 7, -680876936),
                    p = e(p, m, n, o, a[d + 1], 12, -389564586),
                    o = e(o, p, m, n, a[d + 2], 17, 606105819),
                    n = e(n, o, p, m, a[d + 3], 22, -1044525330),
                    m = e(m, n, o, p, a[d + 4], 7, -176418897),
                    p = e(p, m, n, o, a[d + 5], 12, 1200080426),
                    o = e(o, p, m, n, a[d + 6], 17, -1473231341),
                    n = e(n, o, p, m, a[d + 7], 22, -45705983),
                    m = e(m, n, o, p, a[d + 8], 7, 1770035416),
                    p = e(p, m, n, o, a[d + 9], 12, -1958414417),
                    o = e(o, p, m, n, a[d + 10], 17, -42063),
                    n = e(n, o, p, m, a[d + 11], 22, -1990404162),
                    m = e(m, n, o, p, a[d + 12], 7, 1804603682),
                    p = e(p, m, n, o, a[d + 13], 12, -40341101),
                    o = e(o, p, m, n, a[d + 14], 17, -1502002290),
                    n = e(n, o, p, m, a[d + 15], 22, 1236535329),
                    m = f(m, n, o, p, a[d + 1], 5, -165796510),
                    p = f(p, m, n, o, a[d + 6], 9, -1069501632),
                    o = f(o, p, m, n, a[d + 11], 14, 643717713),
                    n = f(n, o, p, m, a[d], 20, -373897302),
                    m = f(m, n, o, p, a[d + 5], 5, -701558691),
                    p = f(p, m, n, o, a[d + 10], 9, 38016083),
                    o = f(o, p, m, n, a[d + 15], 14, -660478335),
                    n = f(n, o, p, m, a[d + 4], 20, -405537848),
                    m = f(m, n, o, p, a[d + 9], 5, 568446438),
                    p = f(p, m, n, o, a[d + 14], 9, -1019803690),
                    o = f(o, p, m, n, a[d + 3], 14, -187363961),
                    n = f(n, o, p, m, a[d + 8], 20, 1163531501),
                    m = f(m, n, o, p, a[d + 13], 5, -1444681467),
                    p = f(p, m, n, o, a[d + 2], 9, -51403784),
                    o = f(o, p, m, n, a[d + 7], 14, 1735328473),
                    n = f(n, o, p, m, a[d + 12], 20, -1926607734),
                    m = g(m, n, o, p, a[d + 5], 4, -378558),
                    p = g(p, m, n, o, a[d + 8], 11, -2022574463),
                    o = g(o, p, m, n, a[d + 11], 16, 1839030562),
                    n = g(n, o, p, m, a[d + 14], 23, -35309556),
                    m = g(m, n, o, p, a[d + 1], 4, -1530992060),
                    p = g(p, m, n, o, a[d + 4], 11, 1272893353),
                    o = g(o, p, m, n, a[d + 7], 16, -155497632),
                    n = g(n, o, p, m, a[d + 10], 23, -1094730640),
                    m = g(m, n, o, p, a[d + 13], 4, 681279174),
                    p = g(p, m, n, o, a[d], 11, -358537222),
                    o = g(o, p, m, n, a[d + 3], 16, -722521979),
                    n = g(n, o, p, m, a[d + 6], 23, 76029189),
                    m = g(m, n, o, p, a[d + 9], 4, -640364487),
                    p = g(p, m, n, o, a[d + 12], 11, -421815835),
                    o = g(o, p, m, n, a[d + 15], 16, 530742520),
                    n = g(n, o, p, m, a[d + 2], 23, -995338651),
                    m = h(m, n, o, p, a[d], 6, -198630844),
                    p = h(p, m, n, o, a[d + 7], 10, 1126891415),
                    o = h(o, p, m, n, a[d + 14], 15, -1416354905),
                    n = h(n, o, p, m, a[d + 5], 21, -57434055),
                    m = h(m, n, o, p, a[d + 12], 6, 1700485571),
                    p = h(p, m, n, o, a[d + 3], 10, -1894986606),
                    o = h(o, p, m, n, a[d + 10], 15, -1051523),
                    n = h(n, o, p, m, a[d + 1], 21, -2054922799),
                    m = h(m, n, o, p, a[d + 8], 6, 1873313359),
                    p = h(p, m, n, o, a[d + 15], 10, -30611744),
                    o = h(o, p, m, n, a[d + 6], 15, -1560198380),
                    n = h(n, o, p, m, a[d + 13], 21, 1309151649),
                    m = h(m, n, o, p, a[d + 4], 6, -145523070),
                    p = h(p, m, n, o, a[d + 11], 10, -1120210379),
                    o = h(o, p, m, n, a[d + 2], 15, 718787259),
                    n = h(n, o, p, m, a[d + 9], 21, -343485551),
                    m = b(m, i),
                    n = b(n, j),
                    o = b(o, k),
                    p = b(p, l);
                return [m, n, o, p]
            }
            function j(a) {
                var b, c = "";
                for (b = 0; b < 32 * a.length; b += 8)
                    c += String.fromCharCode(a[b >> 5] >>> b % 32 & 255);
                return c
            }
            function k(a) {
                var b, c = [];
                for (c[(a.length >> 2) - 1] = void 0,
                b = 0; b < c.length; b += 1)
                    c[b] = 0;
                for (b = 0; b < 8 * a.length; b += 8)
                    c[b >> 5] |= (255 & a.charCodeAt(b / 8)) << b % 32;
                return c
            }
            function l(a) {
                return j(i(k(a), 8 * a.length))
            }
            function m(a, b) {
                var c, d, e = k(a), f = [], g = [];
                for (f[15] = g[15] = void 0,
                e.length > 16 && (e = i(e, 8 * a.length)),
                c = 0; 16 > c; c += 1)
                    f[c] = 909522486 ^ e[c],
                    g[c] = 1549556828 ^ e[c];
                return d = i(f.concat(k(b)), 512 + 8 * b.length),
                j(i(g.concat(d), 640))
            }
            function n(a) {
                var b, c, d = "0123456789abcdef", e = "";
                for (c = 0; c < a.length; c += 1)
                    b = a.charCodeAt(c),
                    e += d.charAt(b >>> 4 & 15) + d.charAt(15 & b);
                return e
            }
            function o(a) {
                return unescape(encodeURIComponent(a))
            }
            function p(a) {
                return l(o(a))
            }
            function q(a) {
                return n(p(a))
            }
            ;return q(a);
        },
        msg: function(opts) {
            var self = this;
            if (this.library.msgindex) {
                console.log(this.library.msgindex);
                this.library.msgindex.card.doCancel();
            }
            ;return this.library.msgindex = new function kuoqimsg() {
                var ths = this;
                this.opts = self.opts(opts, {
                    timeOut: 2500,
                    position: 'c',
                    class: 'card card-api card-msg',
                    format: ['body'],
                    success: null,
                    zIndex: 99,
                    cancel: null,
                }, 'text');
                this.doCancel = function() {
                    this.card.doCancel();
                    this.opts.cancel && this.opts.cancel();
                    this.opts.success && this.opts.success();
                    self.library.msgindex = null;
                }
                ;
                this.content = this.opts.content = self.selector('<div style="padding: 5px 15px;color: #fff;">' + (this.opts.text ? this.opts.text : "") + '</div>');
                this.card = self.card(this.opts);
                this.card.card.body.css("background-color", "#6b6b6b");
                setTimeout(function() {
                    ths.doCancel();
                }, this.opts.timeOut);
            }
            ;
        },
        html2text: function(s, c) {
            return s.toString().replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/'/g, "&#39;");
        },
        opts: function(opts, init, defcode) {
            var obejct = {};
            obejct.version = this.version;
            for (var i in obejct) {
                if (init[i] == undefined) {
                    init[i] = obejct[i];
                }
            }
            ;if (typeof (opts) == 'object') {
                if (Object.prototype.toString.call(opts).indexOf('[object HTML') == 0) {
                    var tmp = opts;
                    opts = {
                        element: tmp
                    };
                }
            } else {
                if (defcode == undefined) {
                    defCode = 'text'
                }
                ;var tmp = opts;
                opts = {};
                if (tmp != undefined) {
                    opts[defcode] = tmp;
                }
            }
            for (var i in opts) {
                init[i] = opts[i];
            }
            ;return init;
        },
        optionsInput: function(options, initObject, defCode) {
            return this.opts(options, initObject, defCode);
        },
        pageOpen: function(opts) {
            var self = this;
            return new function kuoqipage() {
                var ths = this;
                this.opts = self.opts(opts, {
                    zIndex: 0,
                    url: '',
                    tips: '-',
                    classname: 'card card-api card-page',
                    id: self.createID('page', true),
                    width: window.innerWidth + "px",
                    height: window.innerHeight + "px",
                    data: {},
                    format: ['head', 'body'],
                    callback: function() {},
                    pageBack: function() {}
                }, 'url');
                this.id = this.opts.id;
                var str = self.urlEncode(this.opts.data);
                this.opts.url = this.opts.url + (str ? ('?' + str) : '');
                this.iframe = self.selector('<iframe src="' + opts.url + '"></iframe>');
                this.iframe.first(true).onload = function() {
                    self.selector(this.contentDocument).find('html').attr('data-iframeid', ths.opts.templateId);
                }
                ;
                this.opts.content = this.iframe;
                this.iframe.css({
                    'position': 'relative',
                    'width': '100%',
                    'border': 'none',
                    'vertical-align': 'bottom',
                    'height': '100%'
                });
                this.card = self.card(this.opts);
                this.card.card.body.css("padding", "unset");
                this.resetBody = function() {
                    var h1 = this.card.card.head.height();
                    var h2 = this.card.card.body.height();
                    var h3 = this.card.card.foot.height();
                    var w1 = this.card.card.head.width();
                    var w2 = this.card.card.body.width();
                    var w3 = this.card.card.foot.width();
                    h0 = this.card.card.card.height();
                    w0 = this.card.card.card.width();
                    if (w1 + w3 == 0) {
                        this.card.card.body.width(w0 - w1 - w3);
                        this.card.card.body.height(h0 - h1 - h3);
                    }
                }
                ;
                this.resetBody();
                var process = self.process();
                process.setPage(this.id, this);
                this.onMessage = null;
                this.doCancel = function() {
                    this.card.doCancel();
                    process.removePage(this.processName);
                }
                ;
                this.doMessage = function(msg) {
                    if (this.opts.message) {
                        this._callback = this.opts.message;
                        this._callback(msg);
                    }
                    ;this.onMessage && this.onMessage(msg);
                }
            }
        },
        pageMessage: function(id, message) {
            var prc = this.process();
            var page = prc.getPage(id);
            page && page.doMessage && page.doMessage(message);
        },
        pageClose: function(id, data) {
            var prc = this.process();
            var page = prc.getPage(id);
            if (page) {
                prc.removePage(page.processName);
                page.doCancel();
                return true;
            } else {
                return false;
            }
        },
        parseHTML: function(a, justDom, plabel) {
            plabel = plabel ? plabel : 'div';
            var e = document.createElement(plabel);
            e.innerHTML = a;
            return justDom ? e.children : e.childNodes;
        },
        parseJSON: function(s) {
            try {
                return JSON.parse(s + "")
            } catch (err) {
                try {
                    return eval(s);
                } catch (err) {
                    return null;
                }
            }
        },
        parseXML: function(xmlString) {
            var xmlDoc;
            if (typeof xmlString == "string") {
                if (document.implementation.createDocument) {
                    var parser = new DOMParser();
                    xmlDoc = parser.parseFromString(xmlString, "text/xml");
                } else if (window.ActiveXObject) {
                    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
                    xmlDoc.async = false;
                    xmlDoc.loadXML(xmlString);
                }
            } else {
                xmlDoc = xmlString;
            }
            ;return xmlDoc;
        },
        post: function(url, data, success, error) {
            return this.ajax({
                url: url,
                dataType: 'json',
                type: 'post',
                data: data,
                success: success,
                error: error
            });
        },
        prompt: function(opts) {
            var self = this;
            return new function kuoqiprompt() {
                var ths = this;
                this.opts = self.opts(opts, {
                    tips: '',
                    width: ((function() {
                        if (self.isMobile()) {
                            return '80%';
                        } else {
                            return '400px';
                        }
                    }
                    )()),
                    text: '',
                    value: '',
                    type: 'input',
                    textRows: 4,
                    class: 'card card-api card-confirm',
                    sureText: '确定',
                    sureStyle: 'margin: 5px;vertical-align: bottom;box-sizing: border-box;background-color: unset;border: 1px solid #dedede;border-radius: 5px;padding: 5px 10px;opacity: 0.95;cursor: pointer;',
                    cancelText: '取消',
                    cancelStyle: 'margin: 5px;vertical-align: bottom;box-sizing: border-box;background-color: unset;border: 1px solid #dedede;border-radius: 5px;padding: 5px 10px;opacity: 0.95;cursor: pointer;',
                    contentStyle: 'margin:1em;',
                    inputStyle: 'line-height: 1.44rem;margin-top:0.5em;width:100%;',
                    sure: null,
                    cancel: null,
                    checkValied: null,
                });
                this.contentType = self.strtolower(this.opts.type);
                this.onSure = null;
                this.onCheckValied = this.opts.checkValied;
                this.doSure = function() {
                    var content = this.input.val();
                    if (this.onCheckValied) {
                        if (!this.onCheckValied(content)) {
                            return;
                        }
                    }
                    ;this.onSure && this.onSure(content);
                    this.opts.sure && this.opts.sure(content);
                    ths.card.doDestroy();
                }
                ;
                this.content = self.selector('<div style="' + this.opts.contentStyle + '"><div>' + (this.opts.text ? this.opts.text : "") + '</div><div></div></div>');
                this.card = self.card(this.opts);
                if (this.contentType == 'textarea') {
                    this.input = self.selector('<textarea rows="' + this.opts.textRows + '" style="' + this.opts.inputStyle + '"></textarea>');
                } else {
                    this.input = self.selector('<input style="' + this.opts.inputStyle + '" />');
                }
                ;this.card.card.surebtn = self.selector('<button type="button" style="' + this.opts.sureStyle + '">' + this.opts.sureText + '</button>');
                this.card.card.cancelbtn = self.selector('<button type="button" style="' + this.opts.cancelStyle + '">' + this.opts.cancelText + '</button>');
                this.card.card.surebtn.on('click', function(e) {
                    ths.doSure();
                });
                this.card.card.cancelbtn.on('click', function(e) {
                    ths.card.card.titleCloseBtn.click();
                });
                this.content.lastChild().html(this.input);
                this.card.card.body.html(this.content);
                this.card.card.foot.css("text-align", "center");
                this.card.card.foot.append(this.card.card.surebtn);
                this.card.card.foot.append(this.card.card.cancelbtn);
            }
        },
        proxy: function(opts) {
            var self = this;
            opts = this.opts(opts, {
                action: '',
                method: 'get',
                dataType: '',
                data: {},
                responseType: '',
                success: function() {},
                error: function() {},
                progress: function() {},
                header: {
                    "X-Requested-With": "XMLHttpRequest"
                }
            });
            return new function Kproxy() {
                this.opts = opts;
                this.state = 0;
                this.dataType = self.strtoupper(this.opts.dataType);
                this.response = '';
                this.success = this.opts.success;
                this.error = this.opts.error;
                this._data = new FormData();
                this.upload = null;
                this.isSuccess = true;
                this.XMLHttpRequest = ((function() {
                    return (window.XMLHttpRequest) ? (new XMLHttpRequest()) : ((function() {
                        try {
                            return new ActiveXObject("Microsoft.XMLHTTP");
                        } catch (e) {
                            try {
                                return new ActiveXObject("Microsoft.XMLHTTP");
                            } catch (er) {
                                console.log("创建代理对象错误")
                            }
                        }
                    }
                    )());
                }
                )());
                this.emptyDatas = function() {
                    this._data = new FormData()
                }
                ,
                this.setUrl = function(url) {
                    this.opts.action = url;
                }
                ;
                this.hasData = function(code) {
                    if (this._data.get(code)) {
                        return true
                    } else {
                        return false;
                    }
                }
                ;
                this.setData = function(n, v) {
                    if (Object.prototype.toString.call(v) == '[object Object]' || Object.prototype.toString.call(v) == '[object Array]') {
                        this.setDataswithchild(v, n);
                    } else {
                        this._data.set(n, v);
                    }
                }
                ;
                this.setDataswithchild = function(datas, parCode) {
                    for (var i in datas) {
                        if (datas[i] && (typeof (datas[i]) == 'object')) {
                            this.setDataswithchild(datas[i], parCode + "[" + i + "]");
                        } else {
                            this._data.append(parCode + "[" + i + "]", datas[i]);
                        }
                    }
                }
                ,
                this.setDatas = function(datas) {
                    for (var i in datas) {
                        this.setData(i, datas[i]);
                    }
                }
                ;
                this.responseDeal = function(xmlres) {
                    if ((xmlres.status >= 200) && (xmlres.status < 300)) {
                        this.isSuccess = true;
                    } else {
                        this.isSuccess = false;
                    }
                    switch (this.dataType) {
                    case 'JSON':
                        this.response = self.jsonDecode(xmlres.responseText);
                        if (this.response == null) {
                            this.isSuccess = false;
                        }
                        break;
                    case 'BLOB':
                        this.response = xmlres.response;
                        break;
                    default:
                        this.response = xmlres.responseText;
                    }
                    ;if (this.isSuccess) {
                        this.success && this.success(this.response);
                    } else {
                        this.error && this.error();
                    }
                }
                ;
                this.uploadInit = function() {
                    this.upload = this.XMLHttpRequest.upload;
                    this.upload.startTime = null;
                    this.upload.endTime = null;
                    this.upload.speedmsg = 0;
                    this.upload.speed = 0;
                    this.upload.loadedSize = 0;
                    this.upload.fileSize = 0;
                    this.upload.perSize = '0%';
                    this.upload.units = 'b/s';
                    this.upload.onloadstart = function(q) {
                        this.endTime = this.startTime = new Date().getTime();
                        this.fileSize = this.loadedSize = 0;
                    }
                    ;
                    this.upload.onloadend = function() {}
                    ;
                    this.upload.onprogress = function(q) {
                        if (q.lengthComputable) {
                            this.fileSize = q.total;
                            this.perSize = Math.round(this.loadedSize / this.fileSize * 100) + "%";
                            var nt = new Date().getTime()
                              , pt = (nt - this.endTime) / 1000;
                            this.endTime = nt;
                            var preload = q.loaded - this.loadedSize;
                            this.speed = preload / pt;
                            this.loadedSize = q.loaded;
                            if (this.speed / 1024 > 1) {
                                this.speed = this.speed / 1024;
                                this.units = "k/s";
                            }
                            ;if (this.speed / 1024 > 1) {
                                this.speed = this.speed / 1024;
                                this.units = "M/s";
                            }
                            ;this.speed = this.speed.toFixed(2);
                            this.speedmsg = this.speed + this.units;
                            opts.progress && opts.progress(this);
                        }
                    }
                }
                ;
                this.respose = null;
                this.pushStream = function() {
                    var ths = this;
                    for (var i in ths.opts.header) {
                        this.XMLHttpRequest.setRequestHeader(i, ths.opts.header[i]);
                    }
                    ;this.XMLHttpRequest.responseType = this.opts.responseType;
                    this.XMLHttpRequest.onreadystatechange = function() {
                        ths.state = this.readyState;
                        if (this.readyState == 4) {
                            ths.responseDeal(this);
                        }
                    }
                    ;
                    this.uploadInit();
                }
                ;
                this.paramInit = function() {
                    var ths = this;
                    this.opts.method = self.strtoupper(this.opts.method);
                    switch (this.opts.method) {
                    case 'GET':
                        var getstr = '';
                        this._data.forEach(function(v, n) {
                            if (getstr) {
                                getstr += '&' + n + '=' + v;
                            } else {
                                getstr += n + '=' + v;
                            }
                        });
                        ths.noActionpram = true;
                        this.opts.action = this.opts.action.replace(/(\?)(.*)$/, function(p1, p2, p3) {
                            ths.noActionpram = false;
                            if (p3) {
                                return p2 + p3 + '&' + getstr;
                            } else {
                                if (getstr) {
                                    return '?' + getstr;
                                } else {
                                    return '';
                                }
                            }
                        });
                        if (ths.noActionpram && getstr) {
                            this.opts.action += '?' + getstr;
                        }
                        ;break;
                    case 'POST':
                        ;break;
                    default:
                        ;
                    }
                }
                ;
                this.send = function() {
                    this.setDatas(this.opts.data);
                    this.paramInit();
                    this.XMLHttpRequest.open(this.opts.method, this.opts.action, true);
                    this.pushStream();
                    this.XMLHttpRequest.send(this._data);
                }
            }
        },
        quitFullscreen: function(callback) {
            if (document.exitFullscreen) {
                document.exitFullscreen();
            } else if (document.msExitFullscreen) {
                document.msExitFullscreen();
            } else if (document.mozCancelFullScreen) {
                document.mozCancelFullScreen();
            } else if (document.webkitCancelFullScreen) {
                document.webkitCancelFullScreen();
            }
            document.onfullscreenchange = function() {
                callback && callback();
            }
        },
        ready: function(a) {
            console.log('ready');
        },
        rand: function() {
            return Math.random();
        },
        random: function() {
            return parseInt(Math.random() * 10000000);
        },
        randRgb: function() {
            return parseInt(Math.random() * 16).toString(16) + parseInt(Math.random() * 16).toString(16) + parseInt(Math.random() * 16).toString(16);
        },
        setConfig: function(n, v) {
            return this.library.config[n] = v;
        },
        socket: function(config) {
            var self = this;
            return new function KuoqiWebSocket() {
                this.config = self.optionsInput(config, {
                    url: 'ws:\/\/0.0.0.0:6519',
                    dataType: '',
                    data: {
                        message: ''
                    },
                    autoConnect: true,
                    onOpen: null,
                    onError: null,
                    onClose: null,
                    onHeartbeat: null,
                    onHandle: null,
                    onMessage: null,
                    timeOut: 5000,
                }, 'url');
                this.library = {
                    message: [],
                    ready: [],
                    params: this.config.data
                };
                this.onOpen = this.config.onOpen;
                this.onError = this.config.onError;
                this.onClose = this.config.onClose;
                this._callback = null;
                this.ready = function(ready) {
                    var ths = this;
                    if (ready && (typeof (ready) == 'function')) {
                        this.library.ready.push(ready);
                    } else {
                        this.library.ready.forEach(function(func) {
                            ths._callback = func;
                            ths._callback();
                        });
                    }
                }
                ;
                this.stateMessage = function() {
                    switch (this.socket.readyState) {
                    case 0:
                        return "正在连接通讯";
                    case 1:
                        return "通讯连接成功";
                    case 3:
                        return "正在关闭通讯";
                    default:
                        return "通讯已关闭";
                    }
                }
                ,
                this.onMessage = function(msg) {
                    var ths = this;
                    this.library.message.forEach(function(func) {
                        ths._callback = func;
                        ths._callback(msg);
                    });
                }
                ;
                this.message = function(rs) {
                    if (rs && (typeof (rs) == 'function')) {
                        this.library.message.push(rs);
                    }
                }
                ;
                this.doMessage = function(rs) {
                    if (self.strtolower(this.config.dataType) == 'json') {
                        this.onMessage(self.jsonDecode(rs.data));
                    } else {
                        this.onMessage(rs.data);
                    }
                }
                ,
                this.doConnect = function() {
                    var ths = this;
                    this.socket = new WebSocket(this.config.url);
                    this.socket.onopen = function(evt) {
                        ths.onOpen && ths.onOpen(evt);
                        ths.ready();
                    }
                    ;
                    this.socket.onerror = function(evt) {
                        ths.onError && ths.onError(evt);
                    }
                    ;
                    this.socket.onclose = function(evt) {
                        ths.onClose && ths.onClose(evt);
                    }
                    ;
                    this.socket.onmessage = function(evt) {
                        ths.doMessage && ths.doMessage(evt);
                    }
                    ;
                    setTimeout(function() {
                        if (ths.socket.readyState == 0) {
                            ths.socket.close();
                        }
                    }, this.config.timeOut);
                }
                ;
                this.doSend = function(message) {
                    this.socket.send(message);
                }
                ;
                this.send = function(cfg) {
                    if (!cfg) {
                        return null;
                    }
                    ;if (typeof (cfg) != 'object') {
                        console.log('发送失败，请传入一个Hash进行发送数据请求');
                        return;
                    }
                    ;var data = {};
                    for (var i in this.library.params) {
                        data[i] = this.library.params[i];
                    }
                    for (var i in cfg) {
                        data[i] = cfg[i];
                    }
                    ;if (this.socket.readyState == 1) {
                        var blob = new Blob([self.jsonEncode(data)],{
                            type: "application/octet-stream"
                        });
                        this.doSend(blob);
                    } else {
                        console.warn(this.stateMessage());
                    }
                }
                ,
                this.config.autoConnect && this.doConnect();
            }
        },
        stopEvent: function() {
            if (event.stopPropagation) {
                event.stopPropagation();
            } else if (window.event) {
                window.event.cancelBubble = true;
            }
        },
        stringifyJSON: function(o) {
            return JSON.stringify(o)
        },
        strspad: function(s, c, l) {
            return s.toString().padStart(l, c);
        },
        strepad: function(s, c, l) {
            return s.toString().padEnd(l, c);
        },
        strtoupper: function(s) {
            return s ? s.toUpperCase() : null;
        },
        strtolower: function(s) {
            return s ? s.toLowerCase() : null;
        },
        strtoworder: function(s) {
            return s.slice(0, 1).toUpperCase() + s.slice(1)
        },
        timeformat: function(code) {
            var s = parseInt(code);
            var m = parseInt(s / 60);
            s = s % 60;
            var h = parseInt(m / 60);
            m = m % 60;
            return (h ? h : 0) + ":" + (m ? this.strspad(m, '0', 2) : '00') + ":" + (s ? this.strspad(s, '0', 2) : '00');
        },
        upload: function(opts) {
            var ths = this;
            var opts = this.opts(opts, {
                url: this.getConfig('UPLOAD_URI'),
                multiple: false,
                secSize: this.getConfig('UPLOAD_SEC_SIZE'),
                data: this.getConfig('UPLOAD_PARAMS'),
                uploadname: 'filename',
                success: null,
                error: null,
                progress: null,
                cancel: null,
                compress: null,
            });
            if (opts.multiple) {
                var files = this.files();
                files.secSize = this.filesize2byte(Object(opts.secSize).toString());
                files.createBynone(function() {
                    function getItemNeedupload() {
                        for (var i = 0; i < files.files.length; i++) {
                            if (!files.files[i].isUpload) {
                                return files.files[i];
                            }
                        }
                        ;return null;
                    }
                    function UploadOne() {
                        var file = getItemNeedupload();
                        if (file) {
                            file.onsuccess = function() {
                                UploadOne();
                            }
                            ;
                            file.onerror = function() {
                                UploadOne();
                            }
                            ;
                            file.onprogress = function() {
                                console.log('onprogress');
                            }
                            ;
                            file.oncompress = function() {
                                console.log('oncompress');
                            }
                            ;
                            file.def_updata = opts.data;
                            file.uploadName = opts.uploadname;
                            file.secSize = files.secSize;
                            file.upload(opts.action);
                        } else {
                            file.onsuccess = opts.success;
                            file.onerror = opts.error;
                            file.onprogress = opts.progress;
                            file.oncompress = opts.compress;
                        }
                    }
                    UploadOne();
                });
            } else {
                var file = this.file();
                file.onsuccess = opts.success;
                file.onerror = opts.error;
                file.onprogress = opts.progress;
                file.oncompress = opts.compress;
                file.def_updata = opts.data;
                file.uploadName = opts.uploadname;
                file.secSize = this.filesize2byte(Object(opts.secSize).toString());
                file.createBynone(function() {
                    file.upload(opts.action);
                });
            }
        },
        unitlen2int: function(code) {
            code = this.strtoupper(code);
            code.replace(/^([\d\.]+)(PX|VW|VH)$/, function(rs, num, unit) {
                switch (unit) {
                case 'PX':
                    code = num;
                    break;
                case 'VW':
                    code = window.innerWidth * num / 100;
                    break;
                case 'VH':
                    code = window.innerHeight * num / 100;
                    break;
                }
            });
            return parseFloat(code);
        },
        urlDecode: function(code) {
            var arr = [];
            var tml = code.split('&');
            for (var i = 0; i < tml.length; i++) {
                var tmp = tml[i].split('=');
                arr[tmp[0]] = tmp[1] ? tmp[1] : null;
            }
            ;return arr;
        },
        urlEncode: function(code) {
            var str = '';
            for (var i in code) {
                if (str) {
                    str += '&' + i + '=' + code[i];
                } else {
                    str += i + '=' + code[i];
                }
            }
            ;return str;
        },
        validata: function(type, data) {
            type = this.strtolower(type);
            switch (type) {
            case 'tel':
                return /^1[\d]{10}$/.test(data);
            default:
                return true;
            }
        },
        ID: '_' + Math.ceil(Math.random() * 100000),
        library: {
            DEBUG: true,
            plugIn: [],
            config: {
                FORM_IMG_URL: '',
                FORM_IMG_DATA: {},
                UPLOAD_URI: '',
                UPLOAD_SEC_SIZE: 0,
                UPLOAD_PARAMS: {},
            },
            msgindex: null,
            loading: null,
            process: null,
            readlist: [],
        },
        process: function() {
            if (this.isTop) {
                if (window.kuoqiJs.library.process) {
                    return window.kuoqiJs.library.process;
                } else {
                    return window.kuoqiJs.library.process = new function kuoqiJsProcess() {
                        this.set = function(n, v) {
                            this.library[n] = v;
                        }
                        ;
                        this.get = function(n) {
                            return this.library[n];
                        }
                        ;
                        this.setPage = function(n, data) {
                            data.processName = n;
                            data.processIndex = this.library.page.push(data) - 1;
                        }
                        ;
                        this.getPage = function(n) {
                            n = n ? n : '';
                            if (n) {
                                for (var i = 0; i < this.library.page.length; i++) {
                                    if (this.library.page[i].processName == n) {
                                        return this.library.page[i];
                                    }
                                }
                                ;return null;
                            } else {
                                return this.library.page[(this.library.page.length - 1)];
                            }
                        }
                        ;
                        this.removePage = function(n) {
                            var lis = [];
                            for (var i = 0; i < this.library.page.length; i++) {
                                if (this.library.page[i].processName != n) {
                                    lis.push(this.library.page[i]);
                                }
                            }
                            ;this.library.page = lis;
                        }
                        ;
                        this.library = {
                            page: [],
                        };
                    }
                }
            } else {
                return window.top.kuoqiJs.process();
            }
        },
        isTop: ((function() {
            if (window.top == window) {
                return true;
            } else {
                return false;
            }
        }
        )()),
        type: 'KuoqiJsObject',
        version: '1.08',
    })
})
